home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / C / Comet2.1.3.cpt / emlib / setscript.asm < prev    next >
Assembly Source File  |  1991-02-22  |  1KB  |  63 lines

  1. ;    Copyright Cornell University 1986.  All rights are reserved.
  2. ;    kevin eric saunders
  3.  
  4.         public    _setscript
  5.         public    _keytron
  6.  
  7. ;    Assembly language interface to the Script Mgr routines we need
  8. ;    to fix the Option E,I,N,U eating behavior of the standard script
  9. ;    The calls are:
  10. ;
  11. ;        script = GetEnvirons(smKeyScript);
  12. ;        if (!SetScript((int) script, smScriptKeys, (long) EINUSCRIPT) {
  13. ;            KeyScript(script);
  14. ;        }
  15. ;        
  16. ; shove these values (from MPW glue) onto the stack as routine selectors
  17. ;
  18. ;    GetEnvirons = $84020008
  19. ;    SetScript    = $8208000e
  20. ;    KeyScript    = $80020004
  21. ;
  22. ;SetScript(scriptnum)
  23. ;long scriptnum;
  24.     
  25. _setscript
  26.     link    a6,#0
  27.     move.w    d4,-(sp)            ; save d4
  28.     
  29.     tst.w    _keytron
  30.     bne.s    abort        
  31.     
  32.     sub.w    #4,sp                ; clear space for result
  33.     move.w    #22,-(sp)            ; 22 = smKeyScript
  34.     move.l    #$84020008,-(sp)    ; GetEnvirons selector
  35.     dc.w    $a8b5                        ; ScriptUtil Trap
  36.     move.l    (sp)+,d0            ; pop result
  37.     
  38.     move.w    d0,d4                ; save the script #
  39.  
  40.     sub.w    #2,sp                ; clear space for result
  41.     move.w    d0,-(sp)            ; push the script # result
  42.     move.w    #32,-(sp)            ; smScriptKeys
  43.     move.l    8(a6),-(sp)            ; select new script table from arg
  44.     move.l    #$8208000e,-(sp)    ; SetScript selector
  45.     dc.w    $a8b5
  46.     
  47.     move.w    (sp)+,d0            ; pop result
  48.     tst.w    d0
  49.     bne.s    abort
  50.     
  51.     move.w    d4,-(sp)            ; push the script # result
  52.     move.l    #$80020004,-(sp)    ; keyscript selector
  53.     dc.w    $a8b5
  54.     bra.s    return
  55.     
  56. abort
  57.     move.l    #-1,d0
  58.     
  59. return
  60.     move.w    (sp)+,d4            ; restore d4
  61.     unlk    a6
  62.     rts
  63.